package com.piece.member.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import javax.persistence.*;
import java.io.Serializable;

@Data
@Entity
@NoArgsConstructor
@Table(name = "ums_member")
@ApiModel(value = "会员基础信息表")
public class UmsMember implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", length = 11)
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "user_id")
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @Column(name = "level_id")
    @ApiModelProperty(value = "会员等级id")
    private Long levelId;

    @Transient
    @ApiModelProperty(value = "会员等级名称")
    private String levelName;

    @Column(name = "username")
    @ApiModelProperty(value = "用户名")
    private String username;

    @Column(name = "password")
    @ApiModelProperty(value = "密码")
    private String password;

    @Column(name = "nickname")
    @ApiModelProperty(value = "昵称")
    private String nickname;

    @Column(name = "mobile")
    @ApiModelProperty(value = "手机号")
    private String mobile;

    @Column(name = "email")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Column(name = "avatar")
    @ApiModelProperty(value = "头像")
    private String avatar;

    @Column(name = "gender")
    @ApiModelProperty(value = "性别")
    private String gender;

    @Column(name = "birthday")
    @ApiModelProperty(value = "生日")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday;

    @Column(name = "city")
    @ApiModelProperty(value = "所在城市")
    private String city;

    @Column(name = "job")
    @ApiModelProperty(value = "职业")
    private String job;

    @Column(name = "signature")
    @ApiModelProperty(value = "个性签名")
    private String signature;

    @Column(name = "source")
    @ApiModelProperty(value = "用户来源")
    private String source;

    @Column(name = "integration")
    @ApiModelProperty(value = "积分")
    private Long integration;

    @Column(name = "growth")
    @ApiModelProperty(value = "成长值")
    private Long growth;

    @Column(name = "status")
    @ApiModelProperty(value = "启用状态", notes = "0=正常, 1=删除, 2=停用")
    private String status;

    @Column(name = "create_time")
    @ApiModelProperty(value = "注册时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
